const sequelize = require('../db/index.js');
const userModel = sequelize.model('user');

class UserService {
    static async getUser(ctx,queryInfo) {
        const data = await userModel.findAll()
        return data
    }
    static async createUser(ctx,userData) {
        userData.password = ctx.utils.md5(userData.password)
        return await userModel.create(userData);
    }
    static async Login(query) {
		return await userModel.findOne({
			where: {
				username: query
			}
		})
	}
}

module.exports = UserService
